﻿using System.Configuration;
using System.Reflection;

namespace ConfExpert.Datasets
{
    public class CustomConnectionString
    {
        public static void SetConnection(string ConnectionString)
        {
            PropertyInfo[] props = Properties.Settings.Default.GetType().GetProperties();
            foreach (PropertyInfo prop in props)
            {
                SettingsProperty sett = Properties.Settings.Default.Properties[prop.Name];
                if (sett != null) 
                    sett.DefaultValue = ConnectionString;  
            }

            //Properties.Settings.Default["ConfExpertConnectionString"] = ConnectionString;
        }
    }
}
